package sg.edu.nus.iss.vmcs.util;

import java.util.Stack;



public class CommandHistory {
//	For Undo History
	private java.util.Stack<Undoable> commandHistory;
	
//	For undo	
	public void pushCommand(Undoable c){
		if(commandHistory==null)
			commandHistory=new Stack<Undoable>();
		commandHistory.push(c);
	}
	
	public Undoable popCommand(){
		if(commandHistory==null)
			return null;
		if(commandHistory.size()==0)
			return null;
		return commandHistory.pop();
	}
	
	public void clear(){
		if(commandHistory!=null)
			commandHistory.clear();
	}
}
